/**
 * File    : GenericDao.java
 * Created : 2007-12-20
 * By      : lhg
 */
package com.luhuiguo.sso.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @author lhg
 * @version $Id: GenericDao.java 16 2008-10-17 13:13:27Z LuHuiguo $
 * 
 */
public interface GenericDao<T, PK extends Serializable> {

	 T get(PK id);
	 
	 boolean exists(PK id);

	 void create(T entity);

	 T update(T entity);

	 void delete(T entity);

	 void delete(PK id);

	 List<T> findByProperty(String propertyName, final Object value,
			final int... rowStartIdxAndCount);

	 List<T> findAll(final int... rowStartIdxAndCount);

	 List<T> findByNamedQuery(final String queryName,
			final Object... values);

	 List<T> findByNamedQueryAndNamedParams(final String queryName,
			final Map<String, ? extends Object> params);

	 T findFirstByNamedQuery(final String queryName,
			final Object... values);

	 T findFirstByNamedQueryAndNamedParams(final String queryName,
			final Map<String, ? extends Object> params);

}
